<?PHP
if (!session_start()) { session_start(); };
/*if (!isset($_SESSION['lgnapproved'])) {
	die(header('Location: login.php'));
}*/

include("functions.php");
include("cnnxn.php");
connect();

if (isset($_GET['pid'])) {
	$SQLgoi='SELECT * FROM Players WHERE PlayerID='.$_GET['pid'].';';
	$sendgoi=mysqli_query($db,$SQLgoi) or die(mysqli_error($db));
	$RSgoi=mysqli_fetch_object($sendgoi);
	
	if (file_exists('../images/players/'.$RSgoi->Picture)) {		
		unlink('../images/players/'.$RSgoi->Picture);
	}
	
	$SQLdel='DELETE FROM Players WHERE PlayerID='.$_GET['pid'].';';
	//print $SQLdel;
	$sendit_del=mysqli_query($db,$SQLdel) or die(mysqli_error($db));
	die(header("Location: Players_viewall.php"));
}
?>